#!/usr/bin/env python
# -*- coding: utf-8 -*-

import urllib
import urllib2
from random import choice
ua_list =[
        "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
        "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 QIHU 360SE",
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
        "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)",
        "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)"
]
ua = choice(ua_list)
url = "https://movie.douban.com/j/chart/top_list?type=11&interval_id=100%3A90&action"

formatdata = {
"start": "0",
"limit": "20"
}

data = urllib.urlencode(formatdata)
request = urllib2.Request(url, data=data, headers={"User-Agent":ua})

response = urllib2.urlopen(request)
content = response.read()
print(content)